 <template>
<el-dialog title="" visible :show-close="false" :modal-append-to-body="false" class="wrap" @close="cancel" :close-on-click-modal="false">
	<div class="bt">班级详情</div>
		<i class="el-icon-close close" @click="cancel" style="color: white;z-index:10;"></i>
 		<el-form label-width="100px" class="form">
			      <el-table :data="xsdataList" stripe style="width: 100%">
					<el-table-column prop="zwm" label="中文名"></el-table-column>
					<el-table-column prop="ywm" label="英文名"></el-table-column>
					<el-table-column prop="xb" label="性别"></el-table-column>
					<el-table-column prop="jcmc" label="教材名称"></el-table-column>
					<el-table-column prop="kcmc" label="课程名称"></el-table-column>
					<el-table-column prop="ks" label="课时"></el-table-column>
				  </el-table>
 		</el-form>
 		<el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="pageindex"
            :page-sizes="pagesizes"
            :page-size="pagesize"
            :layout="layout"
            :total="total"
            class="class-page">
        </el-pagination>
        
         		<el-button type="primary" class="submit" @click="submit">确定</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {
 				form: {
					 xb :'',
					 zwm :'',
					 ywm :'',
					 jcmc:'',
					 kcmc:'',
					 ks:'',
 					 id:''
 				},
 				xsdataList: [],
 				/*分页属性设置*/
             layout: 'total, sizes, prev, pager, next, jumper',//组件布局
             pageindex: 1,//当前分页页码
             pagesizes: [12, 24, 36, 72],//显示个数的选择器选项
             pagesize: 12,//每页显示条目数
             total: 0,//总条数
 			}
 		},
 		created() {
// 			alert(11)
//			alert(this.params)
   			this.form.id = add
 			this.search()
 		},
 		methods: {
 			search () {
 				var logininfo = JSON.parse(localStorage.logininfo);
              this.searchLoading = true;
             var params2 = qs.stringify({
                      ysbjid:this.form.id +'',
                       yhid:logininfo.id+'',
                       xxid:logininfo.xxid+'',
					   pageindex: this.pageindex,
                       pagesize: this.pagesize,
               })
             //执行
                 this.axios.post(this.$store.state.api + 'xs/getysbjxss',  params2 )
                 .then(res => {
                 if (res.data.code == 1) {
						this.xsdataList = res.data.data.list;
						this.total = res.data.data.totalPage;
						this.$store.state.loading = false;
					}else{
						this.$store.dispatch('showAlert',res.data.msg)
						this.$store.state.loading = false;
					}
                 })
			},

 			 submit() {
 				//检测
 				this.$store.state.loading = true;
 				/*if(!this.form.id) {
 					this.$message.warning('请填写分类');
 					this.$store.state.loading = false;
 					return;
 				}*/
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						id: this.form.id,
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'ysbj/kb',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$emit('close', { type: 'bjxs', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 								this.$emit('close', { type: 'bjxs', cancel: false });
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'bjxs', cancel: true })
 			},
 			handleSizeChange (val) {//每页显示条数触发事件
                this.pagesize = val;
                this.pageindex = 1;
                this.search();
            },

            handleCurrentChange (val) {//分页触发事件
                this.search();
            },
 		}
 	}
 </script>
 <style lang="less" scoped>
 	.wrap {
 		text-align: center;
 	}
 	.form {
 		text-align: left;
 		margin-top: 20px;
 	}
 	.bt{
		 position: absolute;
     width: 100%;
     height: 50px;
     margin: 0 auto;
     top: 0;
     left: 0;
     background: #50BFFF;
     color:white;
     text-align:left;
     line-height: 50px;
     font-size: 17px;
     padding-left: 15px;
		}
 	.input {
             width: 300px;
             display: inline-block;
         }
 	.select-block {
 		display: block;
 	}
 	.submit {
 		width: 120px;
 	}
 	.header{
 		width: 100%;
 		height: 30px;
 		margin: 0 auto;
 	}
 	.one{
 		width: 25%;
 		height: 30px;
 		float: left;
 		text-align: center;
 		line-height: 30px;
 	}
 </style>
